//
//  MenuColl.m
//  card
//
//  Created by 韦显光 on 2018/4/3.
//  Copyright © 2018年 xg韦. All rights reserved.
//

#import "MenuColl.h"
#import "MenuCollCell.h"
@interface MenuColl()<UIScrollViewDelegate>
{
    NSArray*colldata;
}
@end
@implementation MenuColl
+(MenuColl *)instanceCenterViewWithType;
{
    NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"MenuColl" owner:nil options:nil];
    MenuColl *tmpCustomView = [nib objectAtIndex:0];
    return tmpCustomView;
}
-(instancetype)initWithFrame:(CGRect)frame{
    self =[super initWithFrame:frame];
    if (self) {
   
    }
    return  self;
}
-(void)Cellinit:(NSArray*)dataary
{
    
    colldata=@[@"师徒分享",@"大转盘",@"每日签到",@"充值",@"幸运晒单"];
    
    [_collview registerClass:[MenuCollCell class] forCellWithReuseIdentifier:@"MenuCollCell"];
    [_collview reloadData];
}

#pragma mark -- UICollectionViewDataSource 数据源方法
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(DEVW/5-10 ,100);
    
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    
    return colldata.count;
    
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ID = @"MenuCollCell";
    MenuCollCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
    cell.lb1.text=colldata[indexPath.row];
    cell.img.image=WXGImage(colldata[indexPath.row]);
    return cell;
}

#pragma mark --UICollectionViewDelegate

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    NSString*name_str=colldata[indexPath.row];
    [MyUtils collviewSelidex:name_str toVc:[MyUtils getCurrentVC] andShopInfo:nil];
}



@end
